extends NodeState

@export var player: Player
@export var animated_sprite_2D: AnimatedSprite2D

var animation_map: Dictionary = {
									Vector2.UP: "idle_back",
									Vector2.RIGHT: "idle_right",
									Vector2.DOWN: "idle_front",
									Vector2.LEFT: "idle_left",
									Vector2.ZERO: "idle_front"
								}


func _on_process(_delta: float) -> void:
	pass


func _on_physics_process(_delta: float) -> void:
	var animation = animation_map.get(player.player_direction, "idle_front")
	animated_sprite_2D.play(animation)
	
	if player.current_tool && GameInputEvents.is_use_tool():
		var nodeName = DataTypes.tools_node_name_map.get(player.current_tool)
		transition.emit(nodeName)


func _on_next_transitions() -> void:
	if GameInputEvents.is_movement_input(GameInputEvents.movement_input()):
		transition.emit("Walk")
	
func _on_enter() -> void:
	pass


func _on_exit() -> void:
	animated_sprite_2D.stop()
